The Macro edit table is used to assign recurring text to a reference name.
ID A name to identify the macro.
Text Any text to be substituted where the macro name is called. This text may be a complete expression, an entire logic block, or even part of a logic block.
Options Allows you to define the macro as a scenario parameter or select a resource group.
The example table above defines three macros. The first two macros are care profiles. They each contain a complete set of logic describing a specific care process or procedure that a patient might undergo at several different or similar locations. The use of a macro makes it possible to simply enter the macro name anytime and anywhere in operational logic that the patient might require either type of care. The third macro, AMIC_patients, is a scenario parameter used to define the number of acute minor illness clinic (AMIC) patients to be seen in the clinical simulation model (see Scenario Parameters).
A macro is different from a subroutine because a macro cannot pass or return a value. However, because it is simply a text replacement, a macro can reference any expression valid in the expression or logic field that called the macro. For instance, the string “the number of entries is” might be a macro called mac1. This macro by itself is not a valid expression. However, when used with the DISPLAY statement in the operation logic (i.e., DISPLAY mac1), the compiler will recognize the macro as a string.
A macro may be used in any expression field, but may only contain a numeric expression (e.g., Entries (LOC1), U(5,1), Var1+Att2, etc.). In addition, a macro used in an expression field may not contain multiple lines of text. When used in a logic field, the macro may include any logic element valid in that logic field.
Suppose five different locations use the same lines of code. Instead of entering the same logic in five different fields, reference the following macro by typing the macro ID, Care_profile_1, in the operation logic of the patient:
Every time the macro is referenced, the logic is executed. Macros can also be nested within other macros. This means that a macro can consist of one or more other macros. Consider the following Macro edit table:
The macro, Cardiac_Patient references other macros, such as Patient and Blood. Note that some of the other macros, such as Needs, are only portions of a complete line of code. Although the macro is valid, it will not compile as a part of macro logic because the create statement requires an expression and an entity name. The line Cardiac_Patient in a logic field would be interpreted as Create 2 As Blood_Sample Take 1 Lab_Tech.
Macro Notes: 1. A macro may be used only when the elements contained in the macro are appropriate to the context from which it was called. This restriction means that the macro in the previous example is only valid in operation logic. 2. Because a macro simply substitutes some text for its name, if a macro represents a statement block, then it should contain a BEGIN at the beginning of the block, and an END at the end of the block. This technique is especially important when using a macro immediately after a control statement, such as IF...THEN or WHILE...DO. For more information, see Statement Blocks.
![]() |
© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com |